<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->systemName;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/formValidator.jquery/style.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/formValidator.jquery/cn.js"></script>

<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>
</head>

<body>
	<div id="main">
		<div id="navigation">当前位置：<a href="<?php echo $this->projectUrl(array('action'=>'index'));?>">分支协议列表</a> &gt; <a href="<?php echo $this->projectUrl(array('action'=>'child-page-id','childVersion'=>$this->vars['childVersion'],'fieldType'=>$this->vars['fieldType']));?>">[<?php echo $this->vars['childVersion'];?>] <?php echo isset($this->fieldTypeRows[$this->vars['fieldType']]['nameNote']) ? $this->fieldTypeRows[$this->vars['fieldType']]['nameNote'] : '';?> (<?php echo $this->vars['fieldType'];?>) 页面ID列表</a> &gt;<span id="focus">添加id</span></div>
		<div id="body">
			<div id="edit">
				<form id="editForm" name="editForm" method="post" action="">
					<table class="table">
						<tr>
							<td colspan="2">*为必填项</td>
						</tr>
						<tr>
							<td width="20%">分支协议版本号：</td>
							<td>
								<?php echo $this->row['childVersion'];?>
								<input name="childVersion" type="hidden" id="childVersion" value="<?php echo $this->row['childVersion'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">字段类型：</td>
							<td>
								<?php echo isset($this->fieldTypeRows[$this->vars['fieldType']]['nameNote']) ? $this->fieldTypeRows[$this->row['fieldType']]['nameNote'] : '';?> (<?php echo $this->row['fieldType'];?>)
								<input name="fieldType" type="hidden" id="fieldType" value="<?php echo $this->vars['fieldType'];?>" />
								<a href="javascript:void(0);" onclick="$(document).ready(function(){$.fn.colorbox({href:'<?php echo $this->projectUrl(array('controller'=>'act-md-main', 'action'=>'field-type'));?>?'+Math.random()});});">对照</a>
							</td>
						</tr>
						
						<?php if (in_array($this->currentUserRow['userName'], $this->master['developer']) || $this->row['isLock']!=1){?>
						
						<tr>
							<td width="20%">
							页面ID：
							</td>
							<td>
								<input name="pageId" type="text" class="validate[callback[checkPageId,1]] input" id="pageId" value="<?php echo $this->row['pageId'];?>" size="30" style="width:300px;" /> * 
							</td>
						</tr>
						<tr>
							<td width="20%">
							页面名称：
							</td>
							<td>
								<input name="pageName" type="text" class="validate[required] input" id="pageName" value="<?php echo $this->row['pageName'];?>" size="30" style="width:300px;" /> * 
							</td>
						</tr>
						<tr>
							<td width="20%">
							页面类型：
							</td>
							<td>
								<input name="pageType" type="radio" class="type" value="0" <?php echo $this->row['pageType'] == 0 ? ' checked="checked"' : '';?>/> 页面
								<input name="pageType" type="radio" class="type" value="1" <?php echo $this->row['pageType'] == 1 ? ' checked="checked"' : '';?>/> 弹窗
							</td>
						</tr>
						<tr>
							<td width="20%">BI特殊关联ID：</td>
							<td>
								<input name="relationId" type="text" class="input" id="relationId" value="<?php echo $this->row['relationId'];?>" size="30" style="width:300px;" /> 注：默认页面ID。
							</td>
						</tr>
						<tr>
							<td width="20%">是否需要埋点：</td>
							<td>
								<input name="isMd" type="checkbox" value="1"  <?php echo $this->row['isMd'] == 1 ? ' checked="checked"' : '';?>/>
							</td>
						</tr>
						<tr>
							<td width="20%">BI平台判定是否埋点：</td>
							<td>
								<input name="isUseBi" type="checkbox" value="1" <?php echo $this->row['isUseBi'] == 1 ? ' checked="checked"' : '';?>/>
							</td>
						</tr>
						<tr>
							<td width="20%">研发主管判定是否埋点：</td>
							<td>
								<input name="isUseManager" type="checkbox" value="1"  <?php echo $this->row['isUseManager'] == 1 ? ' checked="checked"' : '';?>/>
							</td>
						</tr>
						<tr>
							<td width="20%">当前是否埋点：</td>
							<td>
								<input name="isUserNow" type="checkbox" value="1" <?php echo $this->row['isUserNow'] == 1 ? ' checked="checked"' : '';?>/>  注：埋点人员只用关心此项。
							</td>
						</tr>
						<tr>
							<td width="20%">重要标记：</td>
							<td>
								<input name="isFlag" type="checkbox" value="1" <?php echo $this->row['isFlag'] == 1 ? ' checked="checked"' : '';?>/>
							</td>
						</tr>
						<tr>
							<td width="20%">是否锁定：</td>
							<td>
								<input name="isLock" type="checkbox" value="1" <?php echo $this->row['isLock'] == 1 ? ' checked="checked"' : '';?>/>  注：锁定之后不允许更新。
							</td>
						</tr>
						<tr>
							<td width="20%">埋点时版本：</td>
							<td>
								<input name="mdVersion" type="text" class="input" id="mdVersion" value="<?php echo $this->row['mdVersion'];?>" size="30" style="width:300px;" />
							</td>
						</tr>
						<tr>
							<td width="20%">说明：</td>
							<td><textarea name="note" cols="30" rows="5" class="input" id="note" style="width:300px;"><?php echo $this->row['note'];?></textarea></td>
						</tr>
						<?php }else{?>
						<tr>
							<td width="20%">
							页面ID：
							</td>
							<td>
								<?php echo $this->row['pageId'];?>
								<input name="pageId" type="hidden" id="pageId" value="<?php echo $this->row['pageId'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">
							页面名称：
							</td>
							<td>
								<?php echo $this->row['pageName'];?>
								<input name="pageName" type="hidden" id="pageName" value="<?php echo $this->row['pageName'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">
							页面类型：
							</td>
							<td>
								<?php echo $this->row['pageType'] == 1 ? '弹窗' : '页面';?>
								<input name="pageType" type="hidden" id="pageType" value="<?php echo $this->row['pageType'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">BI特殊关联ID：</td>
							<td>
								<?php echo $this->row['relationId'];?>
								<input name="relationId" type="hidden" id="relationId" value="<?php echo $this->row['relationId'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">是否需要埋点：</td>
							<td>
								<?php echo $this->row['isMd']==1 ? "√": "×";?>
								<input name="isMd" type="hidden" id="isMd" value="<?php echo $this->row['isMd'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">BI平台判定是否埋点：</td>
							<td>
								<?php echo $this->row['isUseBi']==1 ? "√": "×";?>
								<input name="isUseBi" type="hidden" id="isUseBi" value="<?php echo $this->row['isUseBi'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">研发主管判定是否埋点：</td>
							<td>
								<?php echo $this->row['isUseManager']==1 ? "√": "×";?>
								<input name="isUseManager" type="hidden" id="isUseManager" value="<?php echo $this->row['isUseManager'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">当前是否埋点：</td>
							<td>
								<?php echo $this->row['isUserNow']==1 ? "√": "×";?>
								<input name="isUserNow" type="hidden" id="isUserNow" value="<?php echo $this->row['isUserNow'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">重要标记：</td>
							<td>
								<?php echo $this->row['isFlag']==1 ? "√": "×";?>
								<input name="isFlag" type="hidden" id="isFlag" value="<?php echo $this->row['isFlag'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">是否锁定：</td>
							<td>
								<?php echo $this->row['isLock']==1 ? "<font color='red'>锁定</font>": "正常";?>
								<input name="isLock" type="hidden" id="isLock" value="<?php echo $this->row['isLock'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">埋点时版本：</td>
							<td>
								<?php echo $this->row['mdVersion'];?>
								<input name="mdVersion" type="hidden" id="mdVersion" value="<?php echo $this->row['mdVersion'];?>" />
							</td>
						</tr>
						<tr>
							<td width="20%">说明：</td>
							<td>
							<?php echo $this->row['note'];?>
							<input name="note" type="hidden" id="note" value="<?php echo $this->row['note'];?>" />
							</td>
						</tr>
						
						
						<?php }?>
						<tr>
							<td width="20%">备注：</td>
							<td><textarea name="remark" cols="30" rows="5" class="input" id="remark" style="width:300px;"><?php echo $this->row['remark'];?></textarea></td>
						</tr>
						<tr>
							<td width="20%">&nbsp;</td>
							<td><input type="submit" name="button" id="button" value="提交" class="button"/></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>

<script language="javascript">
function checkPageId(account)
{
    var url = '<?php echo $this->projectUrl(array('action'=>'get-page-id-is-exists-by-json','childVersion'=>$this->vars['childVersion'],'id'=>$this->row['id'], 'account'=>'{account}'), NULL, false);?>'+'?rand/' + Math.random();
	url = url.replace('{account}', account);
	checkResult = {'isRight':true, 'message':''};
	
	if ($.trim($("#pageId").val()) == '') {
		return checkResult = {'isRight':false, 'message':' 页面ID。'};
	}
	if (account != '') {
		$.ajax({
			type: "GET",
			url: url,
			dataType: "json",
			async: false,
			success: function(data){
				if (data == 1) {
					checkResult = {'isRight':false, 'message':'* 此协议版本号下的页面ID已存在，请换一个。'};
				}
			} 
		}); 
	}
	return checkResult;
}

$("#editForm").submit(function(){
	return true;
});
</script>
</body>
</html>